package com.cskaoyan.controller.wx;


        import com.cskaoyan.bean.BaseRespVo;
        import com.cskaoyan.bean.pojo.User;
        import com.cskaoyan.bean.wx.address.*;
        import com.cskaoyan.mapper.RegionMapper;
        import com.cskaoyan.service.wx.WxAddressService;
        import org.springframework.beans.factory.annotation.Autowired;
        import org.springframework.web.bind.annotation.RequestBody;
        import org.springframework.web.bind.annotation.RequestMapping;
        import org.springframework.web.bind.annotation.RestController;

        import java.util.List;

//向磊

@RestController
@RequestMapping("wx/address")
public class WxAddressController {

    @Autowired
    WxAddressService wxAddressService;

    @Autowired
    RegionMapper regionMapper;

    //wx/address/list
    @RequestMapping("list")
    public BaseRespVo list(User user){
        List<AddressListVo> data = wxAddressService.addressList(user);
        return BaseRespVo.ok(data);
    }

    //wx/address/detail
    @RequestMapping("detail")
    public BaseRespVo detail(Integer id){
        AddressDetailVo data = wxAddressService.addressDetail(id);
        return BaseRespVo.ok(data);
    }

    //wx/address/save
    @RequestMapping("save")
    public BaseRespVo save(@RequestBody AddressSaveBo addressSaveBo){
        wxAddressService.addressSave(addressSaveBo);
        return BaseRespVo.ok(addressSaveBo.getId());
    }

    //wx/address/delete
    @RequestMapping("delete")
    public BaseRespVo delete(@RequestBody AddressDeleteBo addressDeleteBo){
        wxAddressService.addressDelete(addressDeleteBo);
        return BaseRespVo.ok();
    }




}
